package com.demo.services.impl;

import com.demo.database.data.TDemoDepartment;
import com.demo.database.data.TDemoPosition;
import com.demo.database.mapper.TDemoDepartmentMapper;
import com.demo.services.IDepartmentService;
import com.demo.services.IPositionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;

/**
 * 员工管理业务实现接口实现类
 * @cuthor luoxiaojiang
 * @createTime 2019年11月17日21:07:07
 * @Verson 1.0.0
 */
@Service
public class DepartmentServiceImpl implements IDepartmentService {

    @Resource
    private TDemoDepartmentMapper departmentMapper;

    @Override
    public List<TDemoDepartment> departmentQuery() throws Exception {
        return departmentMapper.departmentQuery();
    }

    @Override
    public TDemoDepartment departmentQueryID(Integer departmentId) throws Exception {
        return departmentMapper.departmentQueryID(departmentId);
    }

    @Override
    public List<TDemoDepartment> departmentQuery1(String context) throws Exception {
        return departmentMapper.departmentQuery1(context);
    }

    @Override
    public List<TDemoDepartment> departmentAdd(TDemoDepartment department) throws Exception {
        department.setOperTime(new Timestamp(System.currentTimeMillis()));
        departmentMapper.departmentAdd(department);
        return departmentMapper.departmentQuery();
    }

    @Override
    public List<TDemoDepartment> departmentUpd(TDemoDepartment department) throws Exception {
        department.setOperTime(new Timestamp(System.currentTimeMillis()));
        departmentMapper.departmentUpd(department);
        return departmentMapper.departmentQuery();
    }

    @Override
    public List<TDemoDepartment> departmentDel(String... ids) throws Exception {
        departmentMapper.departmentDel(ids);
        return departmentMapper.departmentQuery();
    }
}
